﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace SingletonPattern.utils
{
    class String
    {
        public static string uniqueStr()
        {
            return DateTime.Now.ToString("yyyyMMdd_HHmmss_f") +
                "_" + DateTime.Now.Ticks.ToString();
        }

        public static string uniqueStr(string surfix)
        {
            return uniqueStr() + surfix;
        }

        public static string uniqueStr(string prefix, string surfix)
        {
            return prefix + uniqueStr() + surfix;
        }

        /// <summary>
        /// check if a string is null or empty
        /// </summary>
        /// <param name="str">string checked</param>
        /// <returns>true if string is null or empty, else false</returns>
        public static bool isNullEmpty(string str)
        {
            if (string.IsNullOrEmpty(str))
                return true;
            else
                return false;
        }
    }
}
